<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
	<th:block th:include="include :: header('添加说明')" />
	<th:block th:include="include :: bootstrap-fileinput-css" />
	<link th:href="@{/css/common.css}" rel="stylesheet"/>
	<link th:href="@{/css/choose_data_map.css}" rel="stylesheet" />
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight add-question">
	<div class="row">
		<div class="col-sm-12">
			<div class="ibox-content">
				<form class="form-horizontal" id="commentForm">
					<input type="hidden" name="interfaceImgId" th:value="${interfaceImgId}">
					<input type="hidden" name="interfaceId" th:value="${interfaceId}">
					<input type="hidden" name="isMaster" th:value="${isMaster}">
					<div class="form-group">
						<div class="pull-right" style="width: 100%;">
							<textarea name="description" class="form-control" placeholder="添加说明" style="height: 88px;"></textarea>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: bootstrap-fileinput-js" />
<script th:inline="javascript">
	// 接口uri
	const prefix = ctx + "fileInfo/fileInfo";
    if(typeof  parent.getPartImageIntro=='function'){
        $("textarea[name='description']").val(parent.getPartImageIntro())
    }
	function submitHandler() {
		var params = {
			"description":  $("textarea[name='description']").val(),
            "isMaster":$("input[name='isMaster']").val(),
            "id":$("input[name='interfaceImgId']").val()
		};
		var config = {
			url: prefix + "/edit",
			type: "POST",
			dataType: "json",
			data: params,
			beforeSend: function () {
				$.modal.loading("正在处理中，请稍后...");
				$.modal.disable();
			},
			success: function(result) {
				$.modal.closeLoading();
				if (result.code == web_status.SUCCESS) {
					$.modal.close();
					// 父页面更新
                    if(typeof  parent.interfacePartImg=='function'){
                        parent.interfacePartImg($("input[name='interfaceId']").val());
                    }
					return false;
				}
				if (result.code == web_status.WARNING) {
					$.modal.alertWarning(result.msg);
					return false;
				}
				$.modal.alertError(result.msg);
			}
		};
		$.ajax(config);
	}
</script>
</body>
</html>

